Skip to content

fix(ci): pick the Rust fastled binary, not the Python entry-point shim - #65

Merged
zackees merged 1 commit into
mainfrom
fix/ci-rust-cli-finder
May 13, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/ci-rust-cli-finder

Conversation

@zackees

@zackees zackees commented May 13, 2026

Copy link
Copy Markdown
Member

Summary

PR #64 merged with a latent bug that surfaced as red CI on main. The Python-side helpers (project_init.py, playwright/chrome_extension_downloader.py) used shutil.which(\"fastled\") to locate the Rust binary for the new hidden plumbing flags (--internal-ensure-fastled-repo, --internal-ensure-chrome-extension).

In CI (and in any normal editable install), shutil.which(\"fastled\") returns the Python entry-point shim at .venv/Scripts/fastled.exe declared in [project.scripts], NOT the Rust binary at target/debug/fastled.exe. The shim runs fastled.cli:main and rejects the hidden flag with fastled: error: unrecognized arguments: --internal-ensure-fastled-repo. Every unit-test job + the deploy job failed with this exit-2 RuntimeError.

Fix

New src/fastled/_rust_cli.py module with a search order specifically designed to find the Rust binary, not the shim:

  1. Workspace target/{release,debug}/fastled[.exe] (dev builds + CI after cargo test).
  2. $CARGO_HOME/bin/fastled[.exe] and ~/.cargo/bin/fastled[.exe] (the cargo binstall install path).
  3. PATH walk that skips directories hosting a Python interpreter (so the venv Scripts/bin dir with the entry-point shim is filtered out).

Both project_init.py and chrome_extension_downloader.py now import this single helper; their inline finders are deleted.

Test plan

  • bash lint clean (cargo check + clippy + rustfmt + ruff + black + isort + pyright)
  • bash test — 119 passed, 1 skipped (including test_api.py::test_project_init which exercises the subprocess-to-Rust path end-to-end)
  • CI green — both unit-test and deploy jobs that failed on main should now pass

Refs #63, #64

🤖 Generated with Claude Code

CI unit-tests + deploy job failed with

    fastled: error: unrecognized arguments: --internal-ensure-fastled-repo
    RuntimeError: fastled --internal-ensure-fastled-repo failed (exit 2)

because the previous \`_find_rust_fastled_cli()\` used \`shutil.which(\"fastled.exe\")\`,
which returns \`.venv/Scripts/fastled.exe\` — the Python entry-point shim
declared in \`[project.scripts]\`. That shim runs \`fastled.cli:main\` and rejects
the hidden plumbing flag.

Two callers (project_init.py, chrome_extension_downloader.py) had their own
copies of the buggy lookup; both now import a single helper from a new
\`fastled._rust_cli\` module. The new finder:

1. Walks the workspace \`target/{release,debug}/fastled[.exe]\` tree (dev).
2. Checks \`\$CARGO_HOME/bin\` and \`~/.cargo/bin\` (cargo binstall path).
3. Walks PATH manually, skipping any directory that hosts a python
   interpreter (so the venv Scripts/bin dir is filtered out).

Locally: \`bash lint\` clean, 119 unit tests pass.
@zackees
zackees merged commit ec2563a into main May 13, 2026
18 of 25 checks passed
zackees added a commit that referenced this pull request May 13, 2026
PR #65 added a Python `_find_rust_fastled_cli` helper that locates the
Rust binary by walking `target/{release,debug}/`, `$CARGO_HOME/bin`, and
PATH (skipping Python venv dirs). On CI the helper now correctly skips
the Python entry-point shim — but then returns `None` because the Rust
binary is missing entirely:

* `cargo binstall fastled-cli` fails (no release published yet).
* `cargo test --workspace` (in `./test`) compiles the test binary into
  `target/<arch>/debug/deps/` but does not always produce the main bin
  output at `target/<arch>/debug/fastled[.exe]`.
* The Build Webpage / deploy job never runs `cargo test` at all.

So `Api.project_init` / `download_cpp_devtools_extension` fail with
"Could not locate the fastled CLI binary" on every CI runner.

Fix: when cargo-binstall does not supply a pre-built copy, fall back to
`cargo build --release --bin fastled` inside `./install`. Both the
unit-test and deploy jobs go through `./install`, so this covers both
broken paths. Uses the local `_cargo` trampoline so the MSVC target is
forced on Windows (matching where the existing helper searches).

Local: `bash lint` clean, 119 unit tests pass.
zackees added a commit that referenced this pull request May 13, 2026
)

PR #65 added a Python `_find_rust_fastled_cli` helper that locates the
Rust binary by walking `target/{release,debug}/`, `$CARGO_HOME/bin`, and
PATH (skipping Python venv dirs). On CI the helper now correctly skips
the Python entry-point shim — but then returns `None` because the Rust
binary is missing entirely:

* `cargo binstall fastled-cli` fails (no release published yet).
* `cargo test --workspace` (in `./test`) compiles the test binary into
  `target/<arch>/debug/deps/` but does not always produce the main bin
  output at `target/<arch>/debug/fastled[.exe]`.
* The Build Webpage / deploy job never runs `cargo test` at all.

So `Api.project_init` / `download_cpp_devtools_extension` fail with
"Could not locate the fastled CLI binary" on every CI runner.

Fix: when cargo-binstall does not supply a pre-built copy, fall back to
`cargo build --release --bin fastled` inside `./install`. Both the
unit-test and deploy jobs go through `./install`, so this covers both
broken paths. Uses the local `_cargo` trampoline so the MSVC target is
forced on Windows (matching where the existing helper searches).

Local: `bash lint` clean, 119 unit tests pass.
zackees added a commit that referenced this pull request May 13, 2026
Sweeps the non-Python items issue #59 flagged that are still on main
after PRs #61, #62, #64, #65, #66, #68 cleaned up the Python side:

* `entrypoint.sh` — Docker container entrypoint. Sourced
  `/emsdk/emsdk_env.sh` (container path) and called
  `fastled_wasm_compiler.cli_update_from_master` (a module from a
  separate package that only exists inside the container).
* `compiler/run.py` — Docker compile-server entry point. Imports
  `fastled_wasm_compiler`, a separate package not in this repo.
* `compiler/debug.sh` — instructed user to run from `/js` (container
  working directory). Empty `compiler/` directory removed.
* `.dockerignore` — only contained cache exclusions
  (`**/.mypy_cache/`, `**/.ruff_cache/`) which belong in `.gitignore`
  if anywhere; no Docker build context this could serve.
* `chrome_vscode_bridge_design_task.md` — one-off design draft that
  opens with "Here's a refined ... file for your repo. Feel free to
  adjust...". Zero references anywhere else.
* `upload_package.sh` — manual PyPI upload helper, superseded by the
  automated `publish_release.yml` workflow. Zero inbound references.
* Empty root-level `fastled/` directory left over from a prior layout.

`lint` script updated to stop passing the (now-deleted) `compiler/` path
to ruff / black / isort / pyright / the keyboard-interrupt checker.

`bash lint` clean. `bash test` — 119 pass.

Verified by grep across `*.py`, `*.rs`, `*.toml`, `*.yml`, `*.sh`,
`*.md`, `Cargo.toml` (excluding `.venv/` and `.claude/worktrees/`):
none of the deleted files are referenced from a live code path or
workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant